var settings = settings ||{};
var pageContext = new PageContext(settings||{});
pageContext.back = function(target){
	var $lis = $("#page-header>ul>li");
	var len = $lis.length ;
	$($lis.get(len-2)).find("a").click();
}
pageContext.addItemAfter = function(result,para){
	pageContext.back();
};
jQuery(function($) {
	 $(document).find("input").each(function(){
		 $(this).attr("autocomplete","off");
	 });
	pageContext.init();
    var layero = $("#applyeditForm");
	layero.find('select').each(function(){
		var novalid = $(this).attr("noconvert");
		if(novalid=="true"){
			try {
//				layero.find(this).select2();
				if(!ace.vars['touch']) {
					$(this).addClass("chosen-select").chosen({allow_single_deselect:true}); 
					//resize the chosen on window resize
					$(window)
					.off('resize.chosen')
					.on('resize.chosen', function() {
						$('.chosen-select').each(function() {
							 var $this = $(this);
							 $this.next().css({'width': $this.parent().width()});
						})
					}).trigger('resize.chosen');
					//resize chosen on sidebar collapse/expand
					$(document).on('settings.ace.chosen', function(e, event_name, event_val) {
						if(event_name != 'sidebar_collapsed') return;
						$('.chosen-select').each(function() {
							 var $this = $(this);
							 $this.next().css({'width': $this.parent().width()});
						})
					});
				}
			} catch (e) {
				console.log(e)
			}
		}else{
			layero.find(this).select2();
		}
	  });
}); 
